﻿@model MvcApplication4.Models.Thread
@{
    ViewBag.Title = "CreateThread";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Create Thread</h2>
@if (!User.Identity.IsAuthenticated)
{
    <div id="UnauthorizedText">Please @Html.ActionLink("Sign In","Login", "Account") to Post a message.</div>
}
else
{
    using (Html.BeginForm("Submit_CreateThread","Forum"))
    {
        @Html.ValidationSummary(true)
        <fieldset>
            <legend>Create thread in @Html.DisplayFor(model => model.CategoryLink.Title)</legend>
            <p></p>
            Title: @Html.TextBoxFor(model => model.Title, new { Style = "width: 100%;" })
            <div id = "Post_Box">
                <div id="Post_Info">
                    <div id = "Post_Info_text">@User.Identity.Name</div>
                    <div id = "Post_Info_Image"><img src="../../Content/Images/Profile/@{Html.RenderAction("GetUserAvatarURL");}"/></div>
                </div>
    
                <div id="Post_Text">
        
                    <div id="Post_Text_text">
                        @Html.TextAreaFor(model => model.OPLink.Text, new { Class = "editor-field_large" })
                        @Html.ValidationMessageFor(model => model.OPLink.Text)

                        <input type="hidden" name="CategoryId" id="CategoryId" value=@ViewBag.CategoryId />

                    </div>
                    <div id="Post_Signature">Super Signature</div>
                </div>
            </div>
            <div style="margin-top: 25px;">       
            </div>
            <p>
                <input type="submit" value="Create Thread"/>
            </p>
        </fieldset>
    }
}

</div>

<div id="ReturnMenu">
    @Html.ActionLink("Return to Threads", "ReturnToCategory", new { id = @Html.DisplayFor(model => model.Category) })
</div>